import Message from "./message.vue";
import Dialogues from "./dialogue.vue";
import {resolveComponent, render, h, createVNode} from "vue";

export function bMessage(msg, type) {

    let container = document.createElement("div");
    let vNode = h(Message, {
        message: msg,
        type: type
    });
    render(vNode, container);
    document.body.appendChild(container);
}

/**
 * 弹出一个对话框
 * @param title 标题
 * @param content 内容
 * @param button_text 按钮文字
 */
export function bDialogue(title, content, button_text) {
    let container = document.createElement("view");
    render(h(Dialogues, {
        title: title,
        content: content
    }), container);
    document.getElementById("app").appendChild(container);
}

export function toast(msg, type) {
    return  uni.showToast({
        title: msg,
        icon: type
    })
}